package org.crazyit.activiti_d1._3_AddInputStream;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.DeploymentBuilder;

import java.io.File;
import java.io.FileInputStream;

public class AddInputStream {

    public static void main(String[] args) throws Exception {

        //1. 创建流程引擎
        ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();

        //2. 得到流程存储服务实例
        RepositoryService repositoryService = engine.getRepositoryService();

        //3. 第一个资源输入流
        FileInputStream is1 = new FileInputStream(new File("c7/target/classes/flow_inputstream1.png"));

        //4. 第二个资源输入流
        FileInputStream is2 = new FileInputStream(new File("c7/target/classes/flow_inputstream2.png"));

        //5. 创建DeploymentBuilder 实例
        DeploymentBuilder builder = repositoryService.createDeployment();

        //6. 为DeploymentBuilder 添加资源输入流
        builder.addInputStream("inputA",is1);
        builder.addInputStream("inputB",is2);

        //7. 执行部署方法
        builder.deploy();

    }

}
